package com.nuoniu.sibanyun.service.crm.call.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nuoniu.sibanyun.entity.crm.call.CrmCallMinutes;
import com.nuoniu.sibanyun.entity.crm.call.CrmCallMinutesRecord;
import com.nuoniu.sibanyun.mapper.crm.call.CrmCallMinutesRecordMapper;
import com.nuoniu.sibanyun.service.crm.call.ICrmCallMinutesRecordService;
import com.nuoniu.sibanyun.userThread.UserInfo;
import com.nuoniu.sibanyun.userThread.UserThreadLocal;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 * 客户管理-分钟数使用记录 服务实现类
 * </p>
 *
 * @author 白强
 * @since 2022-05-25
 */
@Service
public class CrmCallMinutesRecordServiceImpl extends ServiceImpl<CrmCallMinutesRecordMapper, CrmCallMinutesRecord> implements ICrmCallMinutesRecordService {

    @Override
    public Page pageList(Page page) {
        UserInfo userInfo = UserThreadLocal.get();
        QueryWrapper<CrmCallMinutesRecord> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("company_id",userInfo.getCompanyId());
        this.page(page,queryWrapper);
        return page;
    }

    /**
     * 根据 分钟数使用情况 新增记录
     * @param callMinutes
     */
    @Override
    public void addFromCrmCallMinutes(CrmCallMinutes callMinutes) {

    }

    @Override
    public List<CrmCallMinutesRecord> searchByCrmCallMinutesRecord(CrmCallMinutesRecord crmCallMinutesRecord) {
        QueryWrapper<CrmCallMinutesRecord> queryWrapper = new QueryWrapper<>(crmCallMinutesRecord);
        List<CrmCallMinutesRecord> list = list(queryWrapper);
        return list;
    }
}
